package com.xiaohe66.web.infrastructure.mybatis.sys.sec.convert;

import com.xiaohe66.web.domain.sys.sec.agg.SysConfig;
import com.xiaohe66.web.domain.sys.sec.value.SysConfigId;
import com.xiaohe66.web.domain.sys.sec.value.SysConfigKey;
import com.xiaohe66.web.domain.sys.sec.value.SysConfigValue;
import com.xiaohe66.web.infrastructure.domain.adapter.DataConverter;
import com.xiaohe66.web.infrastructure.mybatis.sys.sec.model.SysConfigDo;
import com.xiaohe66.web.integration.DoConverter;
import org.mapstruct.Mapper;

/**
 * @author xiaohe
 * @since 2023-12-27 17:41
 */
@Mapper(componentModel = "spring")
public interface SysConfigDoConverter extends DoConverter<SysConfig, SysConfigDo>, DataConverter {

    default SysConfigId newId(Long value) {
        return ifPresent(value, SysConfigId::new);
    }

    default SysConfigKey newKey(String value) {
        return ifPresent(value, SysConfigKey::new);
    }

    default SysConfigValue newValue(String value) {
        return ifPresent(value, SysConfigValue::new);
    }

}
